<template>
  <div class="page_root" :key="queryUpdateFlag" data-page-name="配置" data-page-identification="d_9z5yjr5nwo">
    <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
      <!-- begin vid_285m93jlcn 自定义模板_jk1pfzc9c9 -->
      <div class="body">
        <div class="tab-div">
          <a-tabs v-model:activeKey="state.outRadio" @change="getData">
            <a-tab-pane key="平台项目目标进度表" tab="平台项目目标进度表" />
            <a-tab-pane key="里程碑进度表" tab="交付-模板项目里程碑进度表" />
            <a-tab-pane key="年度目标表" tab="交付-模板项目年度目标表" force-render />

            <a-tab-pane key="客户画像" tab="交付模板项目客户画像" />
          </a-tabs>
        </div>
        <div class="inner-div" v-if="state.outRadio === '里程碑进度表'">
          <a-tabs v-model:activeKey="state.innerMilpostRadio" @change="getData">
            <a-tab-pane key="批次" tab="批次" />
            <a-tab-pane key="优先级" tab="优先级" force-render />
            <a-tab-pane key="时间轴" tab="时间轴" />
            <a-tab-pane key="项目" tab="项目" />
          </a-tabs>
          <div style="overflow-y: auto" v-if="state.innerMilpostRadio === '批次'">
            <!--                        <a-col :span="10" :offset="7">-->
            <a-form :model="state.batchList" ref="batchForm">
              <div class="module-item" style="width: 40%" v-for="(item, index) in state.batchList" :key="index">
                <div class="form-content">
                  <a-row gutter="24">
                    <a-col :span="12">
                      <a-form-item label="批次" :rules="[{ required: true, message: '请输入批次！', trigger: 'blur' }]" :name="[index, 'name']">
                        <a-input-number style="width: 100%" v-model:value="state.batchList[index].name" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item label="产品类型" :rules="[{ required: true, message: '请输入产品类型！', trigger: 'blur' }]" :name="[index, 'productType']">
                        <a-input style="width: 100%" v-model:value="state.batchList[index].productType" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>

                <a class="del" @click="handlerDeleteFormItem1(index)">删除</a>
                <a class="add-btn" @click="handlerAddFormItem1(index, '下方')">下方插入</a>
              </div>
            </a-form>
            <!--                        </a-col>-->
            <a-space>
              <a-button type="primary" ghost @click="handlerAddFormItem1(index, '最后')"
                ><template #icon><plus-outlined /></template>新增</a-button
              >
              <a-button type="primary" @click="submit">保存</a-button>
            </a-space>
          </div>
          <div style="overflow-y: auto; height: calc(100vh - 300px)" v-if="state.innerMilpostRadio === '优先级'">
            <a-form :model="state.priorityList" ref="priorityForm">
              <div class="module-item" v-for="(item, index) in state.priorityList" :key="index">
                <div class="form-content">
                  <a-form-item label="优先级" :rules="[{ required: true, message: '请输入优先级！', trigger: 'blur' }]" :name="[index, 'name']">
                    <a-input v-model:value="state.priorityList[index].name" />
                  </a-form-item>
                </div>

                <a class="del" @click="handlerDeleteFormItem2(index)">删除</a>
                <a class="add-btn" @click="handlerAddFormItem2(index, '下方')">下方插入</a>
              </div>
            </a-form>
            <!--                        </a-col>-->
            <a-space>
              <a-button type="primary" ghost @click="handlerAddFormItem2(index, '最后')"
                ><template #icon><plus-outlined /></template>新增</a-button
              >
              <a-button type="primary" @click="submit">保存</a-button>
            </a-space>
          </div>
          <div style="overflow-y: auto; height: calc(100vh - 300px)" v-if="state.innerMilpostRadio === '时间轴'">
            <a-form :model="state.timeAxisList" ref="timeAxiosForm">
              <div class="module-item" style="width: 60%" v-for="(item, index) in state.timeAxisList" :key="index">
                <div class="form-content">
                  <a-row>
                    <a-col :span="12">
                      <a-form-item label="标题" :rules="[{ required: true, message: '请输入标题！', trigger: 'blur' }]" :name="[index, 'name']">
                        <a-input style="width: 100%" v-model:value="state.timeAxisList[index].name" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item
                        label="对应时间"
                        :labelCol="{ span: 6 }"
                        :wrapperCol="{ span: 18 }"
                        :rules="[
                                                    { required: true, message: '请选择对应时间！', trigger: 'blur' }
                                                ]"
                        :name="[index, 'date']"
                      >
                        <a-date-picker value-format="YYYY-MM-DD" style="width: 100%" v-model:value="state.timeAxisList[index].date" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>

                <a class="del" @click="handlerDeleteFormItem3(index)">删除</a>
                <a class="add-btn" @click="handlerAddFormItem3(index, '下方')">下方插入</a>
              </div>
            </a-form>
            <!--                        </a-col>-->
            <a-space>
              <a-button type="primary" ghost @click="handlerAddFormItem3(index, '最后')"
                ><template #icon><plus-outlined /></template>新增</a-button
              >
              <a-button type="primary" @click="submit">保存</a-button>
            </a-space>
          </div>
          <div style="overflow-y: auto; height: calc(100vh - 300px)" v-if="state.innerMilpostRadio === '项目'">
            <div class="default-table">
              <a-table
                bordered
                rowKey="taskId"
                :columns="columns"
                :data-source="state.projectList"
                :pagination="false"
                :scroll="{ y: '600px' }"
                :row-class-name="(_record, index) => (index % 2 === 1 ? 'table-striped' : null)"
              >
                <template #bodyCell="{ column, record }">
                  <template v-if="column.dataIndex === 'priorityId'">
                    <a-select style="width: 100%" v-model:value="record.priorityId" show-search :options="state.priorityIdList" @change="submitBatch(record)" />
                  </template>
                  <template v-if="column.dataIndex === 'batchId'">
                    <a-select allow-clear style="width: 100%" v-model:value="record.batchId" show-search :options="state.batchIdList" @change="submitBatch(record)" />
                  </template>
                </template>
              </a-table>
            </div>
          </div>
        </div>
        <div class="inner-div outer" v-if="state.outRadio === '年度目标表'">
          <a-tabs v-model:activeKey="state.innerYearRadio">
            <a-tab-pane key="时间轴" tab="时间轴" />
          </a-tabs>
          <div style="overflow-y: auto; height: calc(100vh - 300px)">
            <!--                        <a-col :span="10" :offset="7">-->
            <a-form :model="state.yearTimeList" ref="yearBatchForm">
              <div class="module-item" style="width: 60%" v-for="(item, index) in state.yearTimeList" :key="index">
                <div class="form-content">
                  <a-row>
                    <a-col :span="12">
                      <a-form-item label="标题" :rules="[{ required: true, message: '请输入标题！', trigger: 'blur' }]" :name="[index, 'name']">
                        <a-input style="width: 100%" v-model:value="state.yearTimeList[index].name" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item
                        :labelCol="{ span: 6 }"
                        :wrapperCol="{ span: 18 }"
                        label="对应时间"
                        :rules="[
                                                    { required: true, message: '请选择对应时间！', trigger: 'blur' }
                                                ]"
                        :name="[index, 'date']"
                      >
                        <a-date-picker style="width: 100%" value-format="YYYY-MM-DD" v-model:value="state.yearTimeList[index].date" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>

                <a class="del" @click="handlerDeleteFormItem4(index)">删除</a>
                <a class="add-btn" @click="handlerAddFormItem4(index, '下方')">下方插入</a>
              </div>
            </a-form>
            <!--                        </a-col>-->
            <a-space>
              <a-button type="primary" ghost @click="handlerAddFormItem4(index, '最后')"
                ><template #icon><plus-outlined /></template>新增</a-button
              >
              <a-button type="primary" @click="submit">保存</a-button>
            </a-space>
          </div>
        </div>
        <div class="inner-div outer" v-if="state.outRadio === '平台项目目标进度表'">
          <a-tabs v-model:activeKey="state.innerptMilpostRadio">
            <a-tab-pane key="展示项目" tab="展示项目" />
          </a-tabs>
          <div style="overflow-y: auto; height: calc(100vh - 300px)">
            <!--                        <a-col :span="10" :offset="7">-->
            <a-form :model="state.showProjectList" ref="showProjectRef">
              <div class="module-item" style="width: 60%" v-for="(item, index) in state.showProjectList" :key="index">
                <div class="form-content">
                  <a-row>
                    <a-col :span="12">
                      <a-form-item
                        label="项目名称"
                        :rules="[
                                                    { required: true, message: '请选择项目名称！', trigger: 'blur' }
                                                ]"
                        :name="[index, 'projectId']"
                      >
                        <a-select
                          show-search
                          v-model:value="state.showProjectList[index].projectId"
                          :options="state.selectProjectList"
                          allow-clear
                          placeholder="请选择"
                          @focus="getProjectList"
                          :field-names="{ label: 'projectName', value: 'projectId' }"
                          :filter-option="
                                                        (input, option) => {
                                                            return (
                                                                option.projectName
                                                                    .toLowerCase()
                                                                    .indexOf(input.toLowerCase()) >= 0
                                                            )
                                                        }
                                                    "
                        />
                      </a-form-item>
                    </a-col>
                    <a-col :span="12">
                      <a-form-item
                        :labelCol="{ span: 6 }"
                        :wrapperCol="{ span: 18 }"
                        label="排序"
                        :rules="[
                                                    { required: true, message: '请输入序号', trigger: 'blur' },
                                                    {
                                                        pattern: new RegExp(/^(0(\.\d{1,2})?|[1-9]\d*(\.\d{1,2})?)$/),
                                                        message: '仅支持小数点后两位的正数',
                                                        trigger: 'blur'
                                                    }
                                                ]"
                        :name="[index, 'projectSort']"
                      >
                        <a-input-number style="width: 100%" v-model:value="state.showProjectList[index].projectSort" />
                      </a-form-item>
                    </a-col>
                  </a-row>
                </div>

                <a class="del" @click="handlerDeleteFormItem5(index)">删除</a>
                <a class="add-btn" @click="handlerAddFormItem5(index, '下方')">下方插入</a>
              </div>
            </a-form>
            <!--                        </a-col>-->
            <a-space>
              <a-button type="primary" ghost @click="handlerAddFormItem5(index, '最后')"
                ><template #icon><plus-outlined /></template>新增</a-button
              >
              <a-button type="primary" @click="submit">保存</a-button>
            </a-space>
          </div>
        </div>
        <div class="inner-div outer" v-if="state.outRadio === '客户画像'">
          <a-tabs v-model:activeKey="customerProfileItem" @change="getCustomerProfileData">
            <!--            <a-tab-pane key="全部区域" tab="全部区域" />-->
            <a-tab-pane v-for="item in customerProfileList" :key="item" :tab="item"></a-tab-pane>
          </a-tabs>
          <div>
            <a-table size="small" :columns="customerProfileColumns" :data-source="customerProfileData">
              <template #bodyCell="{ column, record }">
                <template v-if="column.dataIndex === 'data'">
                  <a-input-number style="width: 100%" min="0" max="100" v-model:value="record.data" @blur="changeCustomerProfileItem(record)" />
                </template>
                <template v-if="column.dataIndex === 'devicesIntelligentStability'">
                  <a-input-number style="width: 100%" :min="0" :max="100" v-model:value="record.devicesIntelligentStability" @blur="changeCustomerProfileItem(record)" />
                </template>
                <template v-if="column.dataIndex === 'material'">
                  <a-input-number style="width: 100%" :min="0" :max="100" v-model:value="record.material" @blur="changeCustomerProfileItem(record)" />
                </template>
                <template v-if="column.dataIndex === 'staff'">
                  <a-input-number style="width: 100%" :min="0" :max="100" v-model:value="record.staff" @blur="changeCustomerProfileItem(record)" />
                </template>
                <template v-if="column.dataIndex === 'finance'">
                  <a-input-number style="width: 100%" :min="0" :max="100" v-model:value="record.finance" @blur="changeCustomerProfileItem(record)" />
                </template>
              </template>
            </a-table>
          </div>
        </div>
      </div>

      <!-- end vid_285m93jlcn 自定义模板_jk1pfzc9c9 -->
    </a-spin>
  </div>
</template>
<script setup lang="tsx">
  import {
      h, ref, reactive, toRaw, markRaw, watch, computed,
      onBeforeMount, onMounted, onBeforeUnmount, onUnmounted, onActivated, onDeactivated
    } from "vue";
    import { useRoute, useRouter } from 'vue-router';
    const router = useRouter();
    const route = useRoute();
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios';
    import { cloneDeep, localGet, merge, getDifferenceArray, traversalTreeStructure, checkCaseCondition, renderStringInTemplate, handleBreadcrumbJump, throttle, permission, getComponentParamsValue } from '@/utils/index';
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is';
    import dayjs from 'dayjs';
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart';
    import { message, notification, Modal } from 'ant-design-vue'
    import { propertyFormatByNumber, propertyFormatByPercentage, propertyFormatByDate, parseSubFromDataList } from '@/utils/format';
    import colorTheme from '@/design/custom-theme.json';
    
    import UserTableRecords from '@/model/UserTableRecords';
    import { getAppBaseUrl } from '@/utils/index';
    import { sendToken } from "@/hooks/useIframeToken";
    import { useSystemStore } from "@/store/modules/system";
    const systemStore = useSystemStore();
    



      // 获取传入的流程ID和组件参数
      const props = defineProps({
            'processInstanceId': {
            type: [String,Number,Boolean],
            default: undefined,
        },
      })
      const immediateWatch = (source, callback) => {
        watch(source, callback, {deep: true,immediate: true })
      }



  /* -------------------------- 属性定义 -------------------------- */

      const setTimeOutList = [];
      const pageLoading = reactive({
        loading: false,
        tip: undefined
      });
      const authInfo = localGet('app-user-store');




      // 处理校验
      const setSubFormName =(parentInfo, name)=>{
        return [parentInfo.parents, parentInfo.cycleIndex, name];
      }


  /* ========================== 属性定义 ========================== */


  /* -------------------------- 元素数据引用 -------------------------- */


  /* ========================== 元素数据引用 ========================== */


  /* -------------------------- 页面数据 -------------------------- */


  /* ========================== 页面数据 ========================== */



  /* -------------------------- 响应 -------------------------- */

  /* ========================== 响应 ========================== */


  /* -------------------------- 函数 -------------------------- */

  /* ========================== 函数 ========================== */


  /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId,
    })

  /* ========================== 页面参数 ========================== */


  /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------

    // ============================ 组件数据同步 ============================


  /* ========================== 组件事件处理方法 ========================== */


  /* -------------------------- 生命周期 -------------------------- */
  // 用于参数变更后重新执行自定义指令
      const queryUpdateFlag = ref(0);
      onMounted(() => { ;

    });

    onUnmounted(() => {
      // 销毁定时器
      setTimeOutList.forEach(({ repeat, timer }) => {
        repeat ?  clearInterval(timer): clearTimeout(timer);
      });
    });

  /* ========================== 生命周期 ========================== */


  /* -------------------------- 数据关联处理 -------------------------- */





  /* -------------------------- 表单数据同步 -------------------------- */
  /* ========================== 表单数据同步 ========================== */

  /* ========================== 数据关联处理 ========================== */


  /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

  /* ========================== 不同组件自定义的处理逻辑 ========================== */


  // ================================定制化逻辑========================================
  onMounted(() => {
          getData()
          getProjectList()

            getCustomerProfileList()
      })


    // ===============================用户画像========================================
      const customerProfileColumns = [
        {
          title: '项目名称',
          dataIndex: 'projectName',
          align: 'center'
        },{
          title: '数据',
          dataIndex: 'data',
          align: 'center'
        },{
          title: '设备智能化/稳定性',
          dataIndex: 'devicesIntelligentStability',
          align: 'center'
        },{
          title: '材料/原材料',
          dataIndex: 'material',
          align: 'center'
        },{
          title: '人员',
          dataIndex: 'staff',
          align: 'center'
        },{
          title: '财务',
          dataIndex: 'finance',
          align: 'center'
        }
      ];
      const customerProfileData = ref([]);
      const customerProfileItem = ref('');
      const customerProfileList = ref([]);
      function getCustomerProfileList(){
          get('/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/project_customer_profile/table_list').then(res => {

            customerProfileList.value = res.data
            customerProfileItem.value = '全部区域'
          })
      }
      function getCustomerProfileData(data){
        customerProfileData.value = []
          get(`/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/project_customer_profile/?areaName=${data}`).then(res => {
            console.log('data', res)
            customerProfileData.value = res.data
          })
      }
      function changeCustomerProfileItem(data){
        put('/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/project_customer_profile', data)
      }
    // ===================================用户画像 end ===============================







      const state = reactive({
          outRadio: '平台项目目标进度表',
          innerMilpostRadio: '批次',
          innerYearRadio: '时间轴',
          innerptMilpostRadio: '展示项目',
          batchList: [],
          priorityList: [],
          timeAxisList: [],
          projectList: [],
          selectProjectList: [],
          yearTimeList: [],
          showProjectList: [],
          priorityIdList: [],
          batchIdList: []
      })

      const batchItem = {
          name: ''
      }
      const priorityItem = {
          name: undefined
      }

      const timeAxisItem = {
          name: undefined,
          date: undefined
      }
      const yearTimeItem = {
          name: undefined,
          date: undefined
      }
      const showProjectItem = {
          projectId: undefined,
          projectSort: undefined
      }
      const columns = [
          {
              title: '区域',
              dataIndex: 'areaName',
              align: 'center'
          },
          {
              title: '项目',
              dataIndex: 'projectName',
              align: 'center'
          },

          {
              title: '批次',
              dataIndex: 'batchId',
              align: 'center'
          }
          // {
          //     title: '优先级',
          //     dataIndex: 'priorityId',
          //     align: 'center'
          // }
      ]

      //删除一个模块
      function handlerDeleteFormItem1(index) {
          state.batchList.splice(index, 1)
      }
      // 新插一条模块
      function handlerAddFormItem1(index, type) {
          if (type === '最后') {
              state.batchList.push({ ...batchItem })
          } else {
              // 否则使用 splice 方法在 index 后插入
              state.batchList.splice(index + 1, 0, { ...batchItem })
          }
      }
      function handlerDeleteFormItem2(index) {
          state.priorityList.splice(index, 1)
      }
      // 新插一条模块
      function handlerAddFormItem2(index, type) {
          if (type === '最后') {
              state.priorityList.push({ ...priorityItem })
          } else {
              // 否则使用 splice 方法在 index 后插入
              state.priorityList.splice(index + 1, 0, { ...batchItem })
          }
      }
      function handlerDeleteFormItem3(index) {
          state.timeAxisList.splice(index, 1)
      }
      // 新插一条模块
      function handlerAddFormItem3(index, type) {
          if (type === '最后') {
              state.timeAxisList.push({ ...timeAxisItem })
          } else {
              // 否则使用 splice 方法在 index 后插入
              state.timeAxisList.splice(index + 1, 0, { ...batchItem })
          }
      }
      function handlerDeleteFormItem4(index) {
          state.yearTimeList.splice(index, 1)
      }
      // 新插一条模块
      function handlerAddFormItem4(index, type) {
          if (type === '最后') {
              state.yearTimeList.push({ ...yearTimeItem })
          } else {
              // 否则使用 splice 方法在 index 后插入
              state.yearTimeList.splice(index + 1, 0, { ...yearTimeItem })
          }
      }
      function handlerDeleteFormItem5(index) {
          state.showProjectList.splice(index, 1)
      }
      // 新插一条模块
      function handlerAddFormItem5(index, type) {
          if (type === '最后') {
              state.showProjectList.push({ ...showProjectItem })
          } else {
              // 否则使用 splice 方法在 index 后插入
              state.showProjectList.splice(index + 1, 0, { ...showProjectItem })
          }
      }
      function getData() {
          if (state.outRadio === '里程碑进度表' && state.innerMilpostRadio === '项目') {
              get('/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/project_list').then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  state.projectList = data.data
                  getSelectData()
              })
          } else if (state.outRadio === '平台项目目标进度表') {
              get('/solution-ppm/api/v2/built-in-system-ppm/pdtm/goals/project_display/search').then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  if (data.data.length > 0) {
                      state.showProjectList = data.data
                  } else {
                      state.showProjectList = [JSON.parse(JSON.stringify(showProjectItem))]
                  }
              })
          } else {
              get(
                  `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/${state.outRadio}/${
                      state.outRadio === '里程碑进度表' ? state.innerMilpostRadio : state.innerYearRadio
                  }`
              ).then(data => {
                  if (data.code !== 200) {
                      message.error(data.message)
                      return
                  }
                  if (data.data.length > 0) {
                      if (state.outRadio === '里程碑进度表') {
                          if (state.innerMilpostRadio === '批次') {
                              state.batchList = data.data
                          } else if (state.innerMilpostRadio === '优先级') {
                              state.priorityList = data.data
                          } else if (state.innerMilpostRadio === '时间轴') {
                              state.timeAxisList = data.data
                          }
                      } else {
                          state.yearTimeList = data.data
                      }
                  } else {
                      state.batchList = [JSON.parse(JSON.stringify(batchItem))]
                      state.priorityList = [JSON.parse(JSON.stringify(priorityItem))]
                      state.timeAxisList = [JSON.parse(JSON.stringify(timeAxisItem))]
                      state.projectList = []
                      state.yearTimeList = [JSON.parse(JSON.stringify(yearTimeItem))]
                  }
              })
          }
      }
      const yearBatchForm = ref(null)
      const showProjectRef = ref(null)
      const batchForm = ref(null)
      const priorityForm = ref(null)
      const timeAxiosForm = ref(null)
      function submit() {
          if (state.outRadio === '里程碑进度表') {
              if (state.innerMilpostRadio === '批次') {
                  batchForm.value.validate().then(() => {
                      post(
                          `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/${
                              state.outRadio
                          }/${state.outRadio === '里程碑进度表' ? state.innerMilpostRadio : state.innerYearRadio}
                    `,
                          state.batchList
                      )
                          .then(data => {
                              if (data.code !== 200) {
                                  message.error(data.message)
                                  return
                              }
                              message.success(data.message)
                          })
                          .finally(() => {
                              getData()
                          })
                  })
              } else if (state.innerMilpostRadio === '优先级') {
                  priorityForm.value.validate().then(() => {
                      post(
                          `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/${
                              state.outRadio
                          }/${state.outRadio === '里程碑进度表' ? state.innerMilpostRadio : state.innerYearRadio}
                    `,
                          state.priorityList
                      )
                          .then(data => {
                              if (data.code !== 200) {
                                  message.error(data.message)
                                  return
                              }
                              message.success(data.message)
                          })
                          .finally(() => {
                              getData()
                          })
                  })
              } else if (state.innerMilpostRadio === '时间轴') {
                  timeAxiosForm.value.validate().then(() => {
                      post(
                          `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/${
                              state.outRadio
                          }/${state.outRadio === '里程碑进度表' ? state.innerMilpostRadio : state.innerYearRadio}
                    `,
                          state.timeAxisList
                      )
                          .then(data => {
                              if (data.code !== 200) {
                                  message.error(data.message)
                                  return
                              }
                              message.success(data.message)
                          })
                          .finally(() => {
                              getData()
                          })
                  })
              }
          } else if (state.outRadio === '年度目标表') {
              yearBatchForm.value.validate().then(() => {
                  post(
                      `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/${state.outRadio}/${
                          state.outRadio === '里程碑进度表' ? state.innerMilpostRadio : state.innerYearRadio
                      }
                    `,
                      state.yearTimeList
                  )
                      .then(data => {
                          if (data.code !== 200) {
                              message.error(data.message)
                              return
                          }
                          message.success(data.message)
                      })
                      .finally(() => {
                          getData()
                      })
              })
          } else {
              //   保存展示项目
              showProjectRef.value.validate().then(() => {
                  post(`/solution-ppm/api/v2/built-in-system-ppm/pdtm/goals/project_display`, state.showProjectList)
                      .then(data => {
                          if (data.code !== 200) {
                              message.error(data.message)
                              return
                          }
                          message.success(data.message)
                      })
                      .finally(() => {
                          getData()
                      })
              })
          }
      }
      function getSelectData() {
          get(
              `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/里程碑进度表/批次
          `
          ).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              state.batchIdList = data.data.map(item => {
                  return {
                      label: item.name,
                      value: item.id
                  }
              })
          })
          get(
              `/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/batch_priority_time/里程碑进度表/优先级
          `
          ).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              state.priorityIdList = data.data.map(item => {
                  return {
                      label: item.name,
                      value: item.id
                  }
              })
          })
      }
      function submitBatch(record) {
          put('/solution-ppm/api/v2/built-in-system-ppm/dashboard_config/project_config', record).then(data => {
              if (data.code !== 200) {
                  message.error(data.message)
                  return
              }
              message.success(data.message)
              getData()
          })
      }
      //     获取项目
      function getProjectList() {
          get('/solution-ppm/api/v2/built-in-system-ppm/pdtm/project/search').then(data => {
              state.selectProjectList = data.data
          })
      }
</script>
<style lang="less" scoped>
  .page_root {
  width: 100%;
  height: 100%;
  overflow: auto;
  }
  .page_root :deep(.@{ant-prefix}-spin-nested-loading),
  .page_root :deep(.@{ant-prefix}-spin-container)
   {
      height: 100%;
  }
  .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper)
   {
      display: flex;
      flex-flow: column nowrap;
      justify-content: flex-start;
  }
  .page_root :deep(.@{ant-prefix}-table)
   {
    flex: auto;
    overflow: auto;
  }
  .table-moreBtn_down {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 100px;
  }

  .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
    background: #ebf1ff;
  }

  /*  表格树结构样式处理，展开按钮层级增加*/
  :deep(.@{ant-prefix}-table-row-expand-icon) {
    z-index: 1;
  }
  /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
  :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 15px !important;
    width: calc(100% - 15px);
  }
  :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 30px !important;
    width: calc(100% - 30px);
  }
  :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 45px !important;
    width: calc(100% - 45px);
  }
  :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
    left: 60px !important;
    width: calc(100% - 60px);
  }

  /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
  :deep(.@{ant-prefix}-transfer-list)
   {
      height: 100%;
      width: 50%;
  }


  .page_root {
          width: 100%;
          height: 100%;
          overflow: hidden;
      }
      .body {
          background-color: #fff;
          height: 100%;
          padding: 24px;
          padding-top: 0;
      }
      .form-content {
          display: inline-block;
          width: calc(100% - 80px);
      }
      .del {
          width: 28px;
          color: #3875ff;
          position: absolute;
          right: 35px;
          top: 5px;
      }
      .module-item {
          width: 30%;
          position: relative;
      }
      .add-btn {
          position: absolute;
          right: -35px;
          color: #3875ff;
          top: 5px;
      }
      .default-table:deep(.@{ant-prefix}-table-thead) > tr > th {
          background-color: #3875ff;
          color: #fff;
          font-weight: 600;
          padding: 8px 16px;
          border-right: 1px solid #d9d9d9;
      }

      .default-table:deep(.@{ant-prefix}-table-tbody) tr > td {
          font-size: 14px;
          font-family: arial, helvetica, 'microsoft yahei';
          font-weight: 400;
          color: #262626;
          padding: 8px 8px;
          border-bottom: 1px solid #d9d9d9;
          word-break: break-all;
      }
      .inner-div :deep(.ant3-tabs-tab) {
          margin-left: 10px;
      }
      .inner-div :deep(.ant3-tabs-tab-btn) {
          text-align: center;
          width: 68px;
          height: 32px;

          line-height: 32px;
      }
      .inner-div :deep(.ant3-tabs-tab-active) {
          width: 68px;
          height: 32px;
          background: #f0f2f5;
          border-radius: 16px;
          color: #262626;
          line-height: 32px;
          top: 12px;
      }
      .outer :deep(.ant3-tabs-tab-active) {
          width: 68px;
          height: 32px;
          background: #f0f2f5;
          border-radius: 16px;
          color: #262626;
          line-height: 32px;
      }
      .outer :deep(.ant3-tabs-nav-wrap) {
          height: 56px;
      }
      .inner-div :deep(.ant3-tabs-ink-bar) {
          display: none !important;
      }
      .inner-div :deep(.ant3-tabs-tab.ant3-tabs-tab-active .ant3-tabs-tab-btn) {
          color: #262626;
          font-weight: 700;
          background: #f0f2f5;
          border-radius: 16px;
      }
      .tab-div :deep(.ant3-tabs-nav) {
          margin-bottom: 0;
      }
</style>